package com.example.voting_master.schedule;

import com.example.voting_master.service.CandidateVoteStatsService;
import com.example.voting_master.service.VoteThemeService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class RefreshVotesSchedule {

    @Resource
    CandidateVoteStatsService candidateVoteStatsService;

    @Resource
    VoteThemeService voteThemeService;

    @Scheduled(cron = "0/15 * * * * ? ")
    public void refreshAllCandidates(){
        candidateVoteStatsService.updateAllCandidatesVotes();

        voteThemeService.fromRedisUpdateAllThemeVisits();

        voteThemeService.updateAllThemeForRedis();


    }
}
